package com.wondertek.mam.tag.repository;

import com.wondertek.mam.tag.domain.TagDB;
import io.swagger.models.auth.In;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Collection;
import java.util.List;

/**
 *
 * @author wangdongxu
 * @date 2017-09-06 下午 17:11:24
 */
@Repository
public interface TagRepository extends JpaRepository<TagDB,Integer>,JpaSpecificationExecutor<TagDB> {

    List<TagDB> findAllByTagAndHot(String tag, Boolean hot);
    List<TagDB> findAllByTagIn(Collection<String> tags);
    List<TagDB> findAllByUpdateTimeBetweenAndScoreNotAndProtectedTimeBefore(LocalDateTime startDate, LocalDateTime endDate, Integer score,LocalDate protectedTime);
    List<TagDB> findAllByUpdateTimeBeforeAndScoreNotAndProtectedTimeBefore(LocalDateTime endDate, Integer score,LocalDate protectedTime);
    List<TagDB> findAllByHotAndUpdateTimeBeforeAndProtectedTimeBefore(Boolean isHot,LocalDateTime endTime,LocalDate protectedTime);
    List<TagDB> findAllByClassIdAndGroupId(Integer classId,Integer groupId);
    List<TagDB> findAllByGroupIdIn(Collection<Integer> groupId);
//    List<TagDB> findAllByIdInAndGroupIdNot(Collection<Integer> id,Integer groupId);
    List<TagDB> findAllByIdInAndGroupId(Collection<Integer> id,Integer groupId);


}
